package com.demo.admin.executor.mapper;

import com.demo.admin.executor.entity.TmCustomer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @InterfaceName: CustomerMapper
 * @Description: TODO
 * @Author: Liu ZiQi
 * @create: 2020/12/15 15:48
 **/
@Mapper
public interface CustomerMapper {

    @Select("select * from `xxl_job_customer` where `is_deleted` = '0' and `status` = '0'")
    List<TmCustomer> queryCleanCustomer();

    @Update("<script>\n" +
            "update `xxl_job_customer` set `is_deleted` = '1' where `id` in\n" +
            "<foreach collection=\"cleanCustomerIds\" item=\"cleanCustomerId\" index=\"index\" open=\"(\" close=\")\" separator=\",\">\n" +
            "    #{cleanCustomerId}\n" +
            "</foreach>\n" +
            "</script>")
    int doCleanCustomer(@Param("cleanCustomerIds") List<Long> cleanCustomerIds);
}
